# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=sphinxcontrib-svg2pdfconverter
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.0.1
pkgrel=1
arch=('any')
pkgdesc="Sphinx SVG to PDF converter extension (mingw-w64)"
url="https://github.com/sephalon/sphinxcontrib-svg2pdfconverter/"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python")
optdepends=("${MINGW_PACKAGE_PREFIX}-librsvg: Use librsvg engine"
            "${MINGW_PACKAGE_PREFIX}-inkscape: Use inkscape engine")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/archive/v${pkgver}.tar.gz")
sha256sums=('3ee4d762b38df81fdbfb09f67ac35eb866ca4622705e0c40b6e03c3d876c66f6')

prepare() {
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root=${pkgdir} --skip-build
  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/License.txt"
}
